<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link rel="shortcut icon" href="<!--{eval echo register_static('img/touch-icon-57x57.png');}-->">

    <title>粉粉管理系统</title>

    <!-- Bootstrap core CSS -->
    <link href="<!--{eval echo register_static('css/bootstrap.min.css');}-->" rel="stylesheet">
    <link href="<!--{eval echo register_static('css/bootstrap-reset.css');}-->" rel="stylesheet">

    <!--Animation css-->
    <link href="<!--{eval echo register_static('css/animate.css');}-->" rel="stylesheet">

    <!--Icon-fonts css-->
    <link href="<!--{eval echo register_static('assets/font-awesome/css/font-awesome.css');}-->" rel="stylesheet" />
    <link href="<!--{eval echo register_static('assets/ionicon/css/ionicons.min.css');}-->" rel="stylesheet" />

    <link href="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.css');}-->" rel="stylesheet">

    <!-- Plugins css -->
    <link href="<!--{eval echo register_static('assets/modal-effect/css/component.css');}-->" rel="stylesheet">

    <!-- DataTables -->
    <link rel="stylesheet" href="<!--{eval echo register_static('assets/datatables/jquery.dataTables.min.css" rel="stylesheet');}-->" />

    <!-- Custom styles for this template -->
    <link href="<!--{eval echo register_static('css/style.css');}-->" rel="stylesheet">
    <link href="<!--{eval echo register_static('css/helper.css');}-->" rel="stylesheet">

    <!-- My styles for this template -->
    <link href="<!--{eval echo register_static('css/common.css');}-->" rel="stylesheet">

</head>

<body>

<!-- Aside Start-->
<!--{template admin_v2/leftside}-->
<!-- Aside Ends-->


<!--Main Content Start -->
<section class="content">

    <!-- Header -->
    <!--{template admin_v2/header}-->
    <!-- Header Ends -->


    <!-- Page Content Start -->
    <!-- ================== -->

    <div class="wraper container-fluid diary-topics">

        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">计数加权列表</h3>
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-md-12 col-sm-12 col-xs-12">

                                <form action="admin.php" method="get">
                                    <div class="form-inline" role="form">
                                        <div class="form-group">
                                            <select name="type"  class="form-control" id="searchType">
                                                <option value="diary" $type["diary"]>点滴</option>
                                                <option value="topic" $type["topic"]>圈子话题</option>
                                            </select>
                                            <input type="hidden" name="ac" value="count_class">
                                            <input type="hidden" name="op" value="getCountWeightList">
                                        <button type="submit" class="btn btn-success m-l-10">点击查看</button>
                                    </div>
                                </form>

                                <table id="datatable" class="table table-striped table-bordered">
                                    <thead>
                                    <tr>
                                        <th>类型</th>
                                        <th>类型id</th>
                                        <th>n1</th>
                                        <th>n2</th>
                                        <th>n3</th>
                                        <th>n4</th>
                                        <th>n5</th>
                                        <th>创建时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>

                                    <tbody>
                                    <!--{loop $list $info}-->
                                    <tr>
                                        <td>
                                            <!--{if $info['type'] == 1}-->
                                            圈子话题
                                            <!--{/if}-->
                                            <!--{if $info['type'] == 2}-->
                                            点滴
                                            <!--{/if}-->
                                            <!--{if $info['type'] == 3}-->
                                            评论
                                            <!--{/if}-->
                                        </td>
                                        <td>$info['type_id']</td>
                                        <td>$info['n1']</td>
                                        <td>$info['n2']</td>
                                        <td>$info['n3']</td>
                                        <td>$info['n4']</td>
                                        <td>$info['n5']</td>
                                        <td><!--{date('Y-m-d H:i',$info['create_at'])}--></td>
                                        <td class="actions" data-typeid="$info['type_id']" data-type="$type['type']">
                                            <a href="#" class="on-default edit-row btn btn-default btn-sm countinfo" data-toggle="modal" data-target="#con-close-modal"><i class="fa fa-pencil"></i></a>
                                        </td>
                                    </tr>
                                    <!--{/loop}-->
                                    </tbody>
                                </table>
                                <!--{if $pageUrl}-->
                                <ul class="pager">
                                    <li>
                                        <a href="{$pageUrl['prev']}"> <i class="fa fa-angle-double-left"></i>上一页</a>
                                    </li>
                                    <li>
                                        <a href="{$pageUrl['first']}"> <i class="fa"></i>第一页</a>
                                    </li>
                                    <li>
                                        <a href="{$pageUrl['next']}">下一页 <i class="fa fa-angle-double-right"></i> </a>
                                    </li>
                                </ul>
                                <!--{/if}-->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <!-- Page Content Ends -->
    <!-- ================== -->

    <div id="con-close-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">

    </div><!-- /.modal -->

    <!-- Footer Start -->
    <!--{template admin_v2/footer}-->
    <!-- Footer Ends -->

</section>
<!-- Main Content Ends -->


<!-- js placed at the end of the document so the pages load faster -->
<script src="<!--{eval echo register_static('js/jquery.js');}-->"></script>
<script src="<!--{eval echo register_static('js/bootstrap.min.js');}-->"></script>
<script src="<!--{eval echo register_static('js/pace.min.js');}-->"></script>
<script src="<!--{eval echo register_static('js/wow.min.js');}-->"></script>
<script src="<!--{eval echo register_static('js/jquery.nicescroll.js');}-->" type="text/javascript"></script>

<script src="<!--{eval echo register_static('js/jquery.app.js');}-->"></script>

<script src="<!--{eval echo register_static('assets/datatables/jquery.dataTables.min.js');}-->"></script>
<script src="<!--{eval echo register_static('assets/datatables/dataTables.bootstrap.js');}-->"></script>
<script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.js');}-->"></script>
<script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.init.js');}-->"></script>

<!-- Modal-Effect -->
<script src="<!--{eval echo register_static('assets/modal-effect/js/classie.js');}-->"></script>
<script src="<!--{eval echo register_static('assets/modal-effect/js/modalEffects.js');}-->"></script>

<script type="text/javascript">
    $(document).ready(function() {
        // 设置table配置
        $('#datatable').dataTable({
            "iDisplayLength": 50,
            "aLengthMenu": [10, 20, 50, 100],
            "searching": false,
            "bLengthChange" : false,
            "bSort" : false,
            "bPaginate": false
        });

        $(".countinfo").click(function() {
            var info = $(this).parent().data();
            var type_id   = info.typeid;
            var type   = info.type;

            $.ajax(
                    {
                        url     :   "admin.php?ac=count_class&op=getCountWeight",
                        type    :   "POST",
                        data    :   {type_id : type_id, type : type},
                        success :   function(data)
                        {
                            $("#con-close-modal").empty();
                            $("#con-close-modal").append(data);
                        }
                    });
        });

        $(document).on("click",".editcount",function(){
            var param   =   $(".modal-content > form").serialize();
            console.log(param);
            $.ajax(
                    {
                        url     :   "admin.php?ac=count_class&op=editCountWeight",
                        type    :   "POST",
                        data    :   param,
                        success :   function(data)
                        {
                            if (data) {
                                swal({
                                    title: "修改成功",
                                    text: "窗口1秒钟后关闭",
                                    timer: 1000,
                                    showConfirmButton: false
                                });
                            }else{
                                swal({
                                    title: "修改失败",
                                    text: "窗口1秒钟后关闭",
                                    timer: 1000,
                                    showConfirmButton: false
                                });
                            }
//                            refresh();
                        }
                    });
        });

        // 刷新当前页面
        function refresh(){
            setInterval(window.location.reload(),5000);
        }
    } );
</script>
</body>
</html>
